Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add user ID validation and custom error handling in ModelWithPermissions #7605

Open
wants to merge 15 commits into
base: production
Choose a base branch
from

Conversation

Joao-vi
Copy link
Collaborator

@Joao-vi Joao-vi commented Jan 21, 2025

fixes #7389

@Joao-vi Joao-vi self-assigned this Jan 21, 2025
Copy link
Member

@RafaPolit RafaPolit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some minor comments. There are some e2e failing, please rerun the failed tests until they are green. Thanks.

app/api/odm/ModelWithPermissions.ts Outdated Show resolved Hide resolved
@@ -127,20 +128,44 @@ const controlPermissionsData = <T>(
return { ...data, permissions: undefined };
};

export class InvalidUserIdError extends Error {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm unsure about the Error practices we defined. Are we extending native JS Error or are we using our Uwazi Error? I thought we agreed the latter, but maybe I misunderstood something?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, is there any code example of this so I can replicate same behavior here ?

app/api/odm/ModelWithPermissions.ts Outdated Show resolved Hide resolved
app/api/entities/specs/entitySavingManager.spec.ts Outdated Show resolved Hide resolved
app/api/odm/specs/ModelWithPermissions.spec.ts Outdated Show resolved Hide resolved
@Joao-vi Joao-vi requested a review from RafaPolit February 13, 2025 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants